<template>
	<view>
		<view class="center ">
			<view class="d-flex bb" @tap="goBill1">
				<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">代理商区</view>
				<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
				</image>
			</view>
			<view class="d-flex bb" @tap="goBill2">
				<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">会员专区</view>
				<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
				</image>
			</view>
			<view class="d-flex bb" @tap="goFinance">
				<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">资产管理</view>
				<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
				</image>
			</view>
			<view class="d-flex bb" @tap="goTeam">
				<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">销售业绩</view>
				<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
				</image>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				version: ''
			}
		},
		onLoad() {
			if (!this.hasLogin) {
				this.$api.msg('请先登录！', 'none');
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/login/login',
					})
				}, 1000)
				return false;
			}
		},
		computed: {
			...mapState(['hasLogin']),
		},
		methods: {
			...mapMutations(['logout']),
			
			// 代理商专区
			goBill1() {
				uni.navigateTo({
					url: '/pages/user/bill?type=1'
				})
			},
			
			// 会员专区
			goBill2() {
				uni.navigateTo({
					url: '/pages/user/bill?type=2'
				})
			},
			
			// 资产中心
			goFinance() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}
				uni.navigateTo({
					url: '/pages/finance/index'
				})
			},
			
			// 我的团队
			goTeam() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}
				uni.navigateTo({
					url: '/pages/user/team'
				})
			},

		}
	}
</script>

<style>
	.btn {
		color: white;
		background-color: #29ad97;
		border-radius: 50rpx;
		margin: 100rpx 20rpx;
		font-size: 32upx;
		letter-spacing: 2upx;
	}

	page {
		background-color: #f0efee;
	}

	.center {
		width: 94%;
		height: 100%;
		background-color: white;
		margin: 20rpx auto;
		border-radius: 20rpx;
	}

	.bb {
		border: 1rpx solid #f3f3f3;
	}
</style>
